using System;
using System.Configuration;
using System.Linq;
using System.Web.UI;
using CrystalDecisions.CrystalReports.Engine;

namespace App_Code.Utilidades
{
    public class Reportes : Page
    {
        private readonly String _conexion = ConfigurationManager.ConnectionStrings["Electro"].ConnectionString;

        public ReportDocument ClsReportes(string reporte) {
            var report = new ReportDocument();
            var thisDato = new string[4];
            var j = 0;

            var cadenas = _conexion.Split(';');
            foreach (var datos in cadenas.Select(cadena => cadena.Split('='))) {
                for (var i = 0; i < datos.Length; i++) {
                    if (i%2 == 0) continue;
                    thisDato[j] = datos[i];
                    j++;
                }
            }

            report.Load(Server.MapPath(reporte));
            report.SetDatabaseLogon(thisDato[2], thisDato[3], thisDato[0], thisDato[1]);
            return report;
        }
    }
	
	//MAJE maje... aqui esta el cambio
}